# uncompyle6 version 3.2.3
# Python bytecode 3.6 (3379)
# Decompiled from: Python 3.6.8 |Anaconda custom (64-bit)| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: site-packages\PyInstaller\log.py
"""
Logging module for PyInstaller
"""
__all__ = ["getLogger", "INFO", "WARN", "DEBUG", "TRACE", "ERROR", "FATAL"]
import logging
from logging import getLogger, INFO, WARN, DEBUG, ERROR, FATAL

TRACE = logging.TRACE = DEBUG - 5
logging.addLevelName(TRACE, "TRACE")
FORMAT = "%(relativeCreated)d %(levelname)s: %(message)s"
logging.basicConfig(format=FORMAT, level=logging.INFO)
logger = getLogger("PyInstaller")


def __add_options(parser):
    levels = ("TRACE", "DEBUG", "INFO", "WARN", "ERROR", "CRITICAL")
    parser.add_argument(
        "--log-level",
        choices=levels,
        metavar="LEVEL",
        default="INFO",
        dest="loglevel",
        help="Amount of detail in build-time console messages. LEVEL may be one of %s (default: %%(default)s)."
        % (", ").join(levels),
    )


def __process_options(parser, opts):
    try:
        level = getattr(logging, opts.loglevel.upper())
    except AttributeError:
        parser.error("Unknown log level `%s`" % opts.loglevel)
    else:
        logger.setLevel(level)
